/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

jQuery(document).ready(function(){
    jQuery('#newsletter_email').focus( function(){
      jQuery(this).val('');
    })
});

/**
 * 
 */
function updateMessenger( msg ){
    jQuery('#messager').html(msg)
    .slideDown('slow').delay(4000).fadeOut(900);
}


/**
 *
*/
function updateMapsByTownId(num){
    var wilayaGps = new Array();
    wilayaGps[1] = new Array(35.6969444,-0.6330556, 'Oran');
    wilayaGps[2] =new  Array( 36.752887, 3.042048, 'Alger ');
	wilayaGps[3] = new Array(36.7666667,8.3166667, 'El Taref'); 	
	wilayaGps[4]  = new  Array(36.902859,7.755543,'Annaba');
	wilayaGps[5]  = new Array(36.8666667,6.9,'Skikda');	
	wilayaGps[6]  = new Array(36.821899,5.766102,'Jijel');	
	wilayaGps[7]  = new Array(36.75,5.0666667,'Bejaia ');
	wilayaGps[8]  = new Array(36.7166667,4.05,'Tizi Ouzou');
	wilayaGps[9]  = new Array(36.7666667,3.4772222,'Boumerdés');
	wilayaGps[10] =  new Array(36.480499,2.833905,'Blida') ;
	wilayaGps[11] =  new Array(36.5871523,2.4431102,'Tipaza');
	wilayaGps[12] =  new  Array(36.1666667,1.3333333,'Chlef');
	wilayaGps[13] =  new  Array(35.9333333,0.0833333,'Mostaganem');
	wilayaGps[14] = new  Array(35.30241,-1.14489,'Ain Temouchen') ;
	wilayaGps[15] =  new  Array(34.8825,-1.31393,'Tlemcen') ;
	wilayaGps[16] =  new  Array(35.2,-0.6333333,'Sidi Bel Abbès');
	wilayaGps[17] =  new  Array(35.400169,0.139852,'Mascara') ;
	wilayaGps[18] = new  Array(35.7333333,0.55,'Relizane');
	wilayaGps[19] = new  Array(35.6382064,1.9099238,'Tissemsilt');
	wilayaGps[20] = new  Array(36.266667,1.966667,'Ain Defla');	
	wilayaGps[21] = new  Array(36.2666667,2.75,'Medéa') ;
	wilayaGps[22] = new  Array(36.2835299,3.9878427,'Bouira') ;	
	wilayaGps[23] = new  Array(36.0711916,4.7588042,'Bordj Bou Arréridj') ;
	wilayaGps[24] = new  Array(36.18898,5.414416,'Sétif') ;
	wilayaGps[25] = new  Array(36.35,6.6,'Constantine') ;
	wilayaGps[26] = new  Array(36.4659,7.428361,'Guelma') ;
	wilayaGps[27] = new  Array(36.28376,7.955379,'Souk Ahras');
	wilayaGps[28] = new Array(35.8775,7.1136111,'Oum El Bouaghi') ;
	wilayaGps[29] = new Array(36.3647957,6.1526985,'Mila') ;
	wilayaGps[30] = new  Array(35.407139,8.120864,'Tebessa') ;
	
	wilayaGps[31] = new  Array(35.43811,7.146648,'Khenchela') ;
	wilayaGps[32] = new  Array(35.55,6.1666667,'Batna') ;
	wilayaGps[33] = new  Array(35.70018,4.545026,'Msila') ;
	wilayaGps[34] = new  Array(34.6666667, 3.25,'Djelfa') ;
	wilayaGps[35] = new  Array(35.37849,1.32569,'Tiaret') ;
	wilayaGps[36] = new  Array(34.840752,0.149473,'Saida') ;
	wilayaGps[37] = new  Array(33.266667,-0.316667,'Naâma') ;
	wilayaGps[38] = new  Array(33.69347,1.01534,'El Bayadh') ;
	wilayaGps[39] = new  Array(33.8,2.8833333,'Laghouat') ;
	wilayaGps[40] = new  Array(34.85,5.7333333,'Biskra') ;
	wilayaGps[41] = new  Array(33.368309,6.867369,'El Oued') ;
	wilayaGps[42] = new  Array(31.608219,-2.220005,'Béchar') ;
	wilayaGps[43] = new  Array(27.66984,-8.1521,'Tindouf') ;
	wilayaGps[44] = new  Array(27.8666667,-0.2833333,'Adrar') ;
	wilayaGps[45] = new  Array(22.785,5.5227778,'Tamanrasset') ;
	wilayaGps[46] = new  Array(26.5094346,8.4732718,'Illizi') ;
	wilayaGps[47] = new  Array(31.96298,5.342011,'Ouargla') ;
	wilayaGps[48] = new  Array(32.489059,3.678539,'Ghardaïa') ;
	
	
        //alert(num);
        //alert( wilayaGps[num][0]) ;
    initializeMaps( wilayaGps[num][0], wilayaGps[num][1] );
        
}

/**
 * 
 */
function initializeMaps(latitude ,longitude) {
    var mapOptions = {
      center: new google.maps.LatLng(latitude, longitude),
      zoom: 5,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map"), mapOptions);
    marker_4ee131031fbfa = new google.maps.Marker({
        position: new google.maps.LatLng(latitude, longitude),
        map: map
    });

      
  }
  
function validatesendmailForm() {
            var validator = $("#sendmailtoseller").validate({

            /*validation rules */
            rules: {
                    contactSeller_bayer_name: "required",
                    contactSeller_bayer_email: {

                            required: true,
                            email: true
                    },
                    contactSeller_message: "required"
            },
            messages: {
                    contactSeller_bayer_name:		'This field is required',
                    contactSeller_bayer_email: {
                            required:		'This field is required',
                            email:			'Invalid e-mail format'
                    },
                    contactSeller_message:	'This field is required'
            },
            errorPlacement: function(error, element) {

                    /* Error placement */
                    error.insertBefore( element );
            }

    });
}